Skip to main content

Windows: Grabbing ProductGUID when CH is not installed on computer.

Summary: This article shows you how to grab the ProductGUID for Cyberhaven even if the sensor is not installed on your host machine.

Question_md: How can I quickly grab the ProductGUID for different sensor versions without having the CH agent installed?

Answer_md: Sometimes, we will need to grab the Product GUID and sent to customers. Scenarios include customers utilizing an uninstall command such as:

msiexec /uninstall $PRODUCTGUID /quiet

``

``

``

``

In events where you may need to grab ProductGUIDs for multiple sensor versions, the manual methods provided in ourcustomer facing document are time consuming as it requires you to have the sensor version locally installed.

This method only requires you to download the .msi file for the sensor to your local machine and run a PowerShell script. Once you have the .msi downloaded locally, run the following in PowerShell after modifying the file path:

$msiPath = "C:\path\to\your\file.msi"
$installer = New-Object -ComObject WindowsInstaller.Installer
$database = $installer.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $null, $installer, @($msiPath, 0))
$query = "SELECT Value FROM Property WHERE Property = 'ProductCode'"
$view = $database.OpenView($query)
$view.Execute()
$record = $view.Fetch()
$productCode = $record.StringData(1)
Write-Host "ProductCode: $productCode"

``

Here is an example of the output:

You can do this for multiple sensor versions, assuming the .msi files for those versions are downloaded locally.